package com.hhh.tools.viewmodel

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow

class Base64ViewModel : ViewModel() {

    private var showContent = MutableStateFlow(false)
    val show: StateFlow<Boolean> = showContent

    fun setShowContent(isShow: Boolean) {
        showContent.value = isShow
    }

    private var _content = MutableLiveData("")
    val content: LiveData<String> = _content

    private var _input = MutableLiveData("")
    val input: LiveData<String> = _input

    fun onContentChange(content: String) {
        //告诉MutableLiveData数据发生了改变
        _content.value = content
    }

    fun onInputChange(input: String) {
        _input.value = input
    }

    fun onInputPlus(input: String) {
        _input.value = _input.value.plus(input)
    }
}